package a.f.l;

import a.c.bb;
import a.c.d;
import a.c.e;
import a.c.k;
import a.c.m;
import a.c.n;
import a.c.t;
import a.c.v;
import a.f.*;
import a.f.ib;
import a.f.o;
import a.i.wb;

import java.awt.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;

public class hb
  implements vc
{
  private static final String e = "y.layout.router.ORGANIC_EDGE_ROUTER_NODE_SIZE_CHECKED_DPKEY";
  private rc f;
  private o g;
  private Rectangle2D.Double h;
  private double i;
  private ArrayList[][] j;
  private a.c.z k;
  private a.c.z l;
  private double m;
  private double n;
  private double o;
  private double p;
  private int q;
  private int r;
  private int s;
  private wb t;
  private double u;
  private double v;
  private double w;
  private double x;
  private int y;
  private int z;
  private static final double A = 1.2D;
  public static final Object B = "y.layout.router.OrganicEdgeRouter.ROUTE_EDGE_DPKEY";
  private double C;
  private boolean D;
  private boolean E;
  private boolean F = true;
  private ArrayList G;
  private static final double H = 3.0D;
  public static boolean I;
  
  public hb()
  {
    this(10.0D);
  }
  
  public hb(double paramDouble)
  {
    this.C = paramDouble;
  }
  
  public boolean canLayout(o paramo)
  {
    int i1 = g.Cc;
    if (paramo.c("y.layout.router.ORGANIC_EDGE_ROUTER_NODE_SIZE_CHECKED_DPKEY") == null) {
      try
      {
        a(paramo);
      }
      catch (IllegalArgumentException localIllegalArgumentException)
      {
        return false;
      }
    }
    if ((i1 != 0) || (this.f != null)) {
      if (i1 != 0) {
        break label53;
      }
    }
    label53:
    return this.f.canLayout(paramo);
  }
  
  public boolean b()
  {
    return this.F;
  }
  
  public void a(boolean paramBoolean)
  {
    this.F = paramBoolean;
  }
  
  public void doLayout(o paramo)
  {
    int i3 = g.Cc;
    int i2 = g.Bc;
    int i1 = 0;
    if (i3 == 0)
    {
      if (paramo.c("y.layout.router.ORGANIC_EDGE_ROUTER_NODE_SIZE_CHECKED_DPKEY") == null) {
        a(paramo);
      }
    }
    else
    {
      paramo.a("y.layout.router.ORGANIC_EDGE_ROUTER_NODE_SIZE_CHECKED_DPKEY", q.a(Boolean.TRUE));
      i1 = 1;
    }
    if ((i3 != 0) || (this.f != null)) {
      this.f.doLayout(paramo);
    }
    a.i.y localy = new a.i.y(paramo);
    n localn = paramo.C();
    bb localbb = null;
    if ((i3 != 0) || (this.F)) {
      localbb = a(paramo, localn, localy);
    }
    this.G = new ArrayList(paramo.k());
    k localk = null;
    if (b(paramo))
    {
      localk = paramo.c(B);
      localObject = paramo.w();
      do
      {
        if (!((m)localObject).e()) {
          break;
        }
        d locald = ((m)localObject).a();
        if (i3 != 0) {
          break label282;
        }
        if (i2 != 0) {
          break label273;
        }
        if ((i3 != 0) || (localk != null))
        {
          if (i3 != 0) {
            continue;
          }
          if (!localk.getBool(locald)) {}
        }
        else
        {
          if (i3 == 0)
          {
            if (!this.D) {
              wc.b(paramo, locald);
            }
            a(locald);
          }
          if (i3 != 0) {
            continue;
          }
          if (a(paramo.n(locald))) {
            wc.b(paramo, locald);
          }
        }
        ((m)localObject).f();
      } while (i2 == 0);
      if (i3 != 0) {
        break label274;
      }
      d();
    }
    label273:
    label274:
    if ((i3 != 0) || (this.F)) {
      label282:
      a(localbb, paramo, localn, localy);
    }
    paramo.a(localn);
    Object localObject = new ib();
    ((ib)localObject).a((byte)1);
    if (i3 == 0)
    {
      if (localk != null) {
        paramo.a(ib.h, q.c(localk));
      }
      ((ib)localObject).doLayout(paramo);
    }
    if (localk != null) {
      paramo.j(ib.h);
    }
    if (i1 != 0) {
      paramo.j("y.layout.router.ORGANIC_EDGE_ROUTER_NODE_SIZE_CHECKED_DPKEY");
    }
  }
  
  private boolean a(a.d.y paramy)
  {
    int i3 = g.Cc;
    int i2 = g.Bc;
    boolean bool = false;
    a.d.w[] arrayOfw = paramy.h();
    if ((i3 != 0) || (arrayOfw.length > 2))
    {
      int i1 = 0;
      do
      {
        if (i1 >= arrayOfw.length - 2) {
          break;
        }
        a.d.w localw1 = arrayOfw[i1];
        a.d.w localw2 = arrayOfw[(i1 + 1)];
        a.d.w localw3 = arrayOfw[(i1 + 2)];
        a.d.z localz1 = new a.d.z(localw1, localw2);
        a.d.z localz2 = new a.d.z(localw2, localw3);
        double d1 = a.d.z.d(localz1, localz2);
        double d2 = d1 * 180.0D / 3.141592653589793D;
        if (i2 != 0) {
          break label158;
        }
        if (d2 > 90.0D)
        {
          if (i3 != 0) {
            continue;
          }
          if (d2 < 270.0D)
          {
            bool = true;
            if (i3 != 0) {
              continue;
            }
            if (i2 == 0) {
              break;
            }
          }
        }
        i1++;
      } while (i2 == 0);
    }
    label158:
    return bool;
  }
  
  private void a(o paramo)
  {
    a(paramo, paramo);
  }
  
  private void a(t paramt, dc paramdc)
  {
    int i2 = g.Cc;
    int i1 = g.Bc;
    k localk = paramt.c(i.c);
    if ((i2 != 0) || (localk == null)) {
      localk = q.a(Boolean.FALSE);
    }
    Iterator localIterator = paramt.a();
    label105:
    do
    {
      Object localObject;
      do
      {
        if (!localIterator.hasNext()) {
          return;
        }
        localObject = localIterator.next();
        if (i2 != 0) {
          break label105;
        }
        if (localk.getBool(localObject)) {
          break;
        }
        a(paramdc, localObject);
        if (i2 != 0) {
          break label105;
        }
      } while (i1 == 0);
      b(paramdc, localObject);
    } while (i1 == 0);
  }
  
  protected void a(dc paramdc, Object paramObject)
    throws IllegalArgumentException
  {
    zc localzc = paramdc.d(paramObject);
    if ((g.Cc != 0) || ((localzc.c() == 0.0D) || (localzc.d() == 0.0D))) {
      throw new IllegalArgumentException("Graph contains nodes with zero width/height. Please enlarge those nodes manually or by using LayoutStage y.layout.MinNodeSizeStage.");
    }
  }
  
  protected void b(dc paramdc, Object paramObject)
    throws IllegalArgumentException
  {
    zc localzc = paramdc.d(paramObject);
    if ((g.Cc != 0) || ((localzc.c() == 0.0D) || (localzc.d() == 0.0D))) {
      throw new IllegalArgumentException("Graph contains group nodes with zero width/height. Please enlarge those nodes manually or by using LayoutStage y.layout.MinNodeSizeStage.");
    }
  }
  
  private void a(bb parambb, o paramo, n paramn, a.i.y paramy)
  {
    int i2 = g.Cc;
    int i1 = g.Bc;
    if (i2 == 0)
    {
      if (parambb == null) {
        return;
      }
      paramy.g();
    }
    a.c.w localw = parambb.l();
    label145:
    label147:
    do
    {
      do
      {
        if (!localw.e()) {
          return;
        }
        e locale = localw.d();
        m localm = locale.l();
        do
        {
          if (!localm.e()) {
            break;
          }
          d locald1 = localm.a();
          a.d.y localy = paramo.n(locald1);
          d locald2 = (d)paramn.get(locald1);
          paramo.a(locald2, localy);
          localm.f();
          if (i2 != 0) {
            break label147;
          }
          if (i1 != 0) {
            break label145;
          }
        } while (i1 == 0);
        paramo.a(locale);
      } while (i2 != 0);
      localw.f();
    } while (i1 == 0);
  }
  
  private e c(bb parambb, o paramo, n paramn, a.i.y paramy)
  {
    int i2 = g.Cc;
    int i1 = g.Bc;
    if (parambb.size() < 2) {
      return null;
    }
    e locale1 = paramo.i();
    double d1 = 0.0D;
    double d2 = 0.0D;
    a.c.w localw = parambb.l();
    e locale2;
    do
    {
      if (!localw.e()) {
        break;
      }
      locale2 = localw.d();
      d1 = Math.max(d1, paramo.s(locale2));
      d2 = Math.max(d2, paramo.t(locale2));
      if (i2 != 0) {
        break label138;
      }
      localw.f();
      if (i1 != 0) {
        break label134;
      }
    } while (i1 == 0);
    paramo.b(locale1, d1, d2);
    if (i2 == 0) {
      paramo.a(locale1, paramo.o(parambb.m()));
    }
    label134:
    label138:
    localw = parambb.l();
    do
    {
      if (!localw.e()) {
        break;
      }
      locale2 = localw.d();
      if (i1 != 0) {
        break label303;
      }
      m localm = locale2.l();
      do
      {
        do
        {
          if (!localm.e()) {
            break;
          }
          d locald1 = localm.a();
          a.d.y localy = paramo.n(locald1);
          if (i1 != 0) {
            break label303;
          }
          d locald2 = locald1.e() == locale2 ? paramo.a(locale1, locald1.f()) : paramo.a(locald1.e(), locale1);
          paramo.a(locald2, localy);
          paramn.a(locald2, locald1);
          paramy.a(locald1);
          localm.f();
        } while (i1 == 0);
        paramy.a(locale2);
        localw.f();
      } while (i2 != 0);
    } while (i1 == 0);
    label303:
    return locale1;
  }
  
  private bb a(o paramo, n paramn, a.i.y paramy)
  {
    int i3 = g.Cc;
    int i2 = g.Bc;
    bb localbb1 = new bb();
    if (i3 == 0) {
      if (paramo.k() < 2) {
        return localbb1;
      }
    }
    e[] arrayOfe = paramo.t();
    l.a(arrayOfe, new f_(paramo));
    Object localObject = paramo.o(arrayOfe[0]);
    bb localbb2 = new bb(arrayOfe[0]);
    int i1 = 1;
    label186:
    do
    {
      if (i1 >= arrayOfe.length) {
        break;
      }
      e locale1 = arrayOfe[i1];
      a.d.w localw = paramo.o(locale1);
      if (i3 == 0) {
        if (((a.d.w)localObject).equals(localw))
        {
          localbb2.add(locale1);
          if (i3 != 0) {
            continue;
          }
          if (i2 == 0) {
            break label186;
          }
        }
      }
      if (i3 == 0)
      {
        if (localbb2.size() > 1)
        {
          e locale2 = c(localbb2, paramo, paramn, paramy);
          localbb1.add(locale2);
        }
        localObject = localw;
        localbb2.clear();
      }
      localbb2.add(locale1);
      i1++;
    } while (i2 == 0);
    return localbb1;
  }
  
  private boolean b(o paramo)
  {
    int i6 = g.Cc;
    int i5 = g.Bc;
    this.g = paramo;
    this.k = new a.c.z();
    this.l = new a.c.z();
    this.h = new Rectangle2D.Double();
    Rectangle localRectangle = paramo.d();
    this.h.setFrame(localRectangle.x, localRectangle.y, localRectangle.width, localRectangle.height);
    this.t = new wb(42L);
    int i1 = 1 + paramo.j();
    this.q = Math.max(1, (int)Math.ceil(Math.sqrt(i1) * this.h.width / this.h.height));
    this.r = Math.max(1, (int)Math.ceil(i1 / this.q));
    this.o = (this.h.width / this.q);
    this.p = (this.h.height / this.r);
    this.j = new ArrayList[this.r][this.q];
    int i2 = 5 + paramo.j() / (4 * this.r * this.q);
    int i3 = this.r - 1;
    Object localObject;
    do
    {
      if (i3 < 0) {
        break;
      }
      localObject = this.j[i3];
      int i4 = this.q - 1;
      if (i4 >= 0)
      {
        localObject[i4] = new ArrayList(i2);
        i4--;
      }
      for (;;)
      {
        if (i6 == 0) {
          if (i5 == 0)
          {
            if (i5 == 0) {
              break;
            }
            if (i6 != 0) {
              continue;
            }
            i3--;
          }
        }
      }
    } while (i5 == 0);
    a.c.w localw = paramo.v();
    do
    {
      do
      {
        if (!localw.e()) {
          break;
        }
        localObject = localw.d();
        if (i6 != 0) {
          break label435;
        }
        zc localzc = paramo.d(localObject);
        a(((e)localObject).f(), localzc.a(), localzc.b(), localzc.c(), localzc.d(), this.C);
        localw.f();
        if (i5 != 0) {
          break label434;
        }
      } while (i5 == 0);
      if (i6 != 0) {
        break;
      }
    } while (i6 != 0);
    if (this.F) {
      c();
    }
    a(this.C);
    this.s = 0;
    label434:
    label435:
    return paramo != null;
  }
  
  private void c()
  {
    int i4 = g.Cc;
    int i3 = g.Bc;
    int i1 = 0;
    label177:
    do
    {
      if (i1 >= this.G.size()) {
        break;
      }
      g_ localg_1 = (g_)this.G.get(i1);
      int i2 = i1 + 1;
      do
      {
        do
        {
          if (i2 >= this.G.size()) {
            break label177;
          }
          g_ localg_2 = (g_)this.G.get(i2);
          double d1 = a.d.w.a(localg_1.a, localg_1.b, localg_2.a, localg_2.b);
          double d2 = localg_1.h + localg_2.h + 3.0D;
          if (i3 != 0) {
            break;
          }
          if (d1 < d2)
          {
            double d3 = d1 / d2;
            double d4 = localg_1.h * d3;
            double d5 = localg_2.h * d3;
            localg_1.g = Math.min(localg_1.g, d4);
            localg_2.g = Math.min(localg_2.g, d5);
          }
          i2++;
        } while (i3 == 0);
        i1++;
      } while (i4 != 0);
    } while (i3 == 0);
  }
  
  private void a(int paramInt, double paramDouble1, double paramDouble2, double paramDouble3, double paramDouble4, double paramDouble5)
  {
    double d = Math.sqrt(paramDouble3 * paramDouble3 + paramDouble4 * paramDouble4) * 0.5D + paramDouble5;
    g_ localg_ = new g_(paramInt, paramDouble1 + paramDouble3 / 2.0D, paramDouble2 + paramDouble4 / 2.0D, d, 2.0D);
    this.G.add(localg_);
    a(localg_);
  }
  
  private void a(g_ paramg_)
  {
    int i8 = g.Cc;
    int i7 = g.Bc;
    int i1 = Math.max(0, (int)((paramg_.a - paramg_.g - this.h.x) / this.o));
    int i2 = Math.max(0, (int)((paramg_.b - paramg_.g - this.h.y) / this.p));
    int i3 = Math.min(this.q - 1, (int)((paramg_.a + paramg_.g - this.h.x) / this.o));
    int i4 = Math.min(this.r - 1, (int)((paramg_.b + paramg_.g - this.h.y) / this.p));
    int i5 = i2;
    do
    {
      if (i5 > i4) {
        break;
      }
      ArrayList[] arrayOfArrayList = this.j[i5];
      int i6 = i1;
      if (i6 <= i3)
      {
        arrayOfArrayList[i6].add(paramg_);
        i6++;
      }
      for (;;)
      {
        if (i8 == 0) {
          if (i7 == 0)
          {
            if (i7 == 0) {
              break;
            }
            if (i8 != 0) {
              continue;
            }
            i5++;
          }
        }
      }
    } while (i7 == 0);
  }
  
  private boolean a(double paramDouble1, double paramDouble2, double paramDouble3, double paramDouble4, int paramInt1, int paramInt2)
  {
    int i9 = g.Cc;
    int i8 = g.Bc;
    double d1 = paramDouble3 - paramDouble1;
    double d2 = paramDouble4 - paramDouble2;
    double d3 = Math.sqrt(d1 * d1 + d2 * d2);
    int i1 = (int)Math.floor((Math.min(paramDouble1, paramDouble3) - this.h.x - this.x) / this.o);
    int i2 = (int)Math.floor((Math.min(paramDouble2, paramDouble4) - this.h.y - this.x) / this.p);
    int i3 = (int)Math.floor((Math.max(paramDouble1, paramDouble3) - this.h.x + this.x) / this.o) + 1;
    int i4 = (int)Math.floor((Math.max(paramDouble2, paramDouble4) - this.h.y + this.x) / this.p) + 1;
    i1 = Math.max(0, i1);
    i2 = Math.max(0, i2);
    i3 = Math.min(i3, this.j[0].length);
    i4 = Math.min(i4, this.j.length);
    this.s += 1;
    int i5 = i2;
    label586:
    label599:
    do
    {
      do
      {
        if (i5 >= i4) {
          break;
        }
        ArrayList[] arrayOfArrayList = this.j[i5];
        if (i8 != 0) {
          break label613;
        }
        int i6 = i1;
        do
        {
          if (i6 >= i3) {
            break label599;
          }
          ArrayList localArrayList = arrayOfArrayList[i6];
          if (i8 != 0) {
            break;
          }
          int i7 = localArrayList.size() - 1;
          do
          {
            do
            {
              if (i7 < 0) {
                break label586;
              }
              g_ localg_ = (g_)localArrayList.get(i7);
              if (i8 != 0) {
                break;
              }
              if (localg_.e != this.s)
              {
                localg_.e = this.s;
                if (i9 != 0) {
                  continue;
                }
                if ((localg_.k != paramInt1) && ((i9 != 0) || (localg_.k != paramInt2)))
                {
                  double d4 = localg_.a - paramDouble1;
                  double d5 = localg_.b - paramDouble2;
                  double d6 = (d4 * d1 + d5 * d2) / d3;
                  double d7 = -d6 / d3;
                  double d8 = d4 + d7 * d1;
                  double d9 = d5 + d7 * d2;
                  double d10 = Math.sqrt(d8 * d8 + d9 * d9);
                  if ((i9 != 0) || (d10 <= localg_.g))
                  {
                    double d11 = Math.sqrt(d4 * d4 + d5 * d5);
                    if (i9 == 0) {
                      if (d11 < localg_.g) {
                        return true;
                      }
                    }
                    double d12 = localg_.a - paramDouble3;
                    double d13 = localg_.b - paramDouble4;
                    double d14 = Math.sqrt(d12 * d12 + d13 * d13);
                    if (i9 == 0) {
                      if (d14 < localg_.g) {
                        return true;
                      }
                    }
                    if (i9 != 0) {
                      continue;
                    }
                    if (d6 >= 0.0D)
                    {
                      if (i9 != 0) {
                        continue;
                      }
                      if (d6 < d3)
                      {
                        if (i9 != 0) {
                          continue;
                        }
                        if (d10 < localg_.g) {
                          return true;
                        }
                      }
                    }
                  }
                }
              }
              i7--;
            } while (i8 == 0);
            i6++;
          } while (i9 != 0);
        } while (i8 == 0);
        i5++;
      } while (i9 != 0);
    } while (i8 == 0);
    label613:
    return false;
  }
  
  private void a(double paramDouble)
  {
    this.u = (1.5D + paramDouble * 0.05D);
    this.C = paramDouble;
    this.v = (paramDouble * 0.6D);
    this.w = 0.1D;
    this.n = (2.0D * paramDouble);
    this.n *= this.n;
    this.m = (0.5D * paramDouble);
    this.m *= this.m;
    this.x = (2.0D * paramDouble + 100.0D);
  }
  
  private void d()
  {
    this.g = null;
    this.k = null;
    this.j = ((ArrayList[][])null);
    this.l = null;
  }
  
  private void a(d paramd)
  {
    int i8 = g.Cc;
    int i7 = g.Bc;
    e locale1 = paramd.e();
    e locale2 = paramd.f();
    this.y = locale1.f();
    this.z = locale2.f();
    zb localzb = this.g.e(paramd);
    this.k.clear();
    a.d.w localw1 = localzb.d();
    zc localzc = this.g.d(locale2);
    a.d.w localw2 = new a.d.w(localzc.a() + localzc.c() * 0.5D + localw1.a, localzc.b() + localzc.d() * 0.5D + localw1.b);
    localw1 = localzb.c();
    localzc = this.g.d(locale1);
    a.d.w localw3 = new a.d.w(localzc.a() + localzc.c() * 0.5D + localw1.a, localzc.b() + localzc.d() * 0.5D + localw1.b);
    int i1 = 6;
    double d1 = this.C;
    this.C = (d1 * (1 << i1));
    a(this.C);
    this.i = 0.0D;
    d_ locald_1 = a(localw2.a, localw2.b);
    locald_1.i = this.k.b(locald_1);
    Object localObject2;
    if (i8 == 0)
    {
      if (localzb.a() > 0)
      {
        localObject1 = new a.d.w(localw2.a, localw2.b);
        int i2 = localzb.a() - 1;
        do
        {
          if (i2 < 0) {
            break;
          }
          localObject2 = localzb.a(i2);
          if (i7 != 0) {
            break label442;
          }
          if (this.F)
          {
            if (i8 != 0) {
              continue;
            }
            if (a.d.w.a((a.d.w)localObject1, (a.d.w)localObject2) < d1 + 20.0D) {}
          }
          else
          {
            locald_1 = a(((a.d.w)localObject2).a, ((a.d.w)localObject2).b);
            locald_1.i = this.k.a(locald_1);
            localObject1 = localObject2;
          }
          i2--;
        } while (i7 == 0);
      }
      locald_1 = a(localw3.a, localw3.b);
      locald_1.i = this.k.a(locald_1);
    }
    label442:
    boolean bool = false;
    if (i8 == 0) {
      if (this.E)
      {
        bool = true;
        if (i7 == 0) {
          break label571;
        }
      }
    }
    Object localObject1 = this.k.g();
    v localv1 = this.k.f();
    do
    {
      if (localv1 == localObject1) {
        break;
      }
      localObject2 = (d_)localv1.c();
      d_ locald_3 = (d_)localv1.a().c();
      bool = a(((d_)localObject2).b, ((d_)localObject2).c, locald_3.b, locald_3.c, this.y, this.z);
      if (i7 != 0) {
        break label578;
      }
      if (bool) {
        break;
      }
      localv1 = localv1.a();
    } while (i7 == 0);
    label571:
    if (i8 == 0)
    {
      if (bool)
      {
        label578:
        do
        {
          if (this.k.size() >= 8) {
            break;
          }
          if (i8 != 0) {
            break label1153;
          }
          if (i7 != 0) {
            break label1152;
          }
          if (i1 <= 0) {
            break;
          }
          i1--;
          this.C = (d1 * (1 << i1));
          a(this.C);
          c(this.C);
        } while (i7 == 0);
        localObject1 = new c_();
        b(this.u);
        int i3 = Math.max(i1, 1);
        int i4 = 1;
        if (i8 != 0) {
          break label1246;
        }
        double d2 = Math.max(10.0D, d1 * 0.2D);
        label1094:
        if ((d1 * (1 << i3) > d2) && ((i8 != 0) || (i3 >= 0)))
        {
          if (i8 == 0)
          {
            if (i4 == 0)
            {
              this.C = (d1 * (1 << i3));
              a(this.C);
              c(this.C);
              b(this.u);
            }
            i4 = 0;
            i3--;
          }
          int i5 = 150 - i3 * 20;
          int i6 = 30;
          label973:
          label975:
          do
          {
            do
            {
              break label1094;
              if (i6-- <= 0)
              {
                if (i5-- <= 0) {
                  break;
                }
                if ((i8 != 0) || (i8 != 0)) {
                  break label1153;
                }
                if (i7 != 0) {
                  break label1152;
                }
                if (this.i / this.k.size() < 1.2D * (i3 + 2)) {
                  break;
                }
              }
              do
              {
                if (i8 == 0)
                {
                  if (this.k.size() > 2)
                  {
                    v localv3 = this.k.g();
                    d_ locald_4 = (d_)this.k.f().c();
                    locald_4.l = (locald_4.m = locald_4.n = 0.0D);
                    v localv4 = this.k.f().a();
                    d_ locald_5;
                    do
                    {
                      do
                      {
                        if (localv4 == null) {
                          break;
                        }
                        locald_5 = (d_)localv4.c();
                        c(locald_5);
                        if (i8 != 0) {
                          break label975;
                        }
                        localv4 = localv4.a();
                        if (i7 != 0) {
                          break label973;
                        }
                      } while (i7 == 0);
                    } while (i8 != 0);
                    localv4 = this.k.f().a();
                    do
                    {
                      do
                      {
                        if (localv4 == localv3) {
                          break;
                        }
                        locald_5 = (d_)localv4.c();
                        double d3 = a(locald_5, (c_)localObject1);
                        a(locald_5, (c_)localObject1, d3);
                        if (i8 != 0) {
                          break label1051;
                        }
                        localv4 = localv4.a();
                        if (i7 != 0) {
                          break label1049;
                        }
                      } while (i7 == 0);
                    } while (i8 != 0);
                    localv4 = this.k.f().a();
                    do
                    {
                      if (localv4 == localv3) {
                        break label1094;
                      }
                      locald_5 = (d_)localv4.c();
                      e(locald_5);
                      localv4 = localv4.a();
                      if ((i8 == 0) && (i7 != 0)) {
                        break;
                      }
                    } while (i7 == 0);
                  }
                  if (i8 != 0) {
                    break label787;
                  }
                }
                if (this.k.size() >= 3) {
                  break;
                }
                i5 = 0;
              } while (i8 != 0);
            } while (i7 != 0);
            if ((i8 != 0) || (i8 != 0)) {
              break;
            }
          } while (i7 == 0);
        }
      }
      localzb.b();
    }
    else
    {
      if (this.k.size() > 2)
      {
        e();
        localObject1 = this.k.g();
        v localv2 = this.k.f().a();
        do
        {
          if (localv2 == localObject1) {
            break;
          }
          d_ locald_2 = (d_)localv2.c();
          localzb.a(locald_2.b, locald_2.c);
          localv2 = localv2.a();
          if ((i8 == 0) && (i7 != 0)) {
            return;
          }
        } while (i7 == 0);
      }
      f();
      if (i8 != 0) {
        return;
      }
    }
    label787:
    label1049:
    label1051:
    label1246:
    this.C = d1;
    label1152:
    label1153:
    return;
  }
  
  private void e()
  {
    int i2 = g.Cc;
    int i1 = g.Bc;
    if (i2 == 0) {
      if (this.k.size() < 3) {
        return;
      }
    }
    v localv = this.k.f();
    d_ locald_ = (d_)localv.c();
    double d1 = locald_.b;
    double d2 = locald_.c;
    localv = localv.a();
    locald_ = (d_)localv.c();
    double d3 = locald_.b;
    double d4 = locald_.c;
    localv = localv.a();
    if (localv != null) {
      locald_ = (d_)localv.c();
    }
    label274:
    while (i2 != 0)
    {
      double d5 = d3 - d1;
      double d6 = d4 - d2;
      double d7 = locald_.b;
      double d8 = locald_.c;
      double d9 = d7 - d1;
      double d10 = d8 - d2;
      double d11 = -(d9 * d5 + d10 * d6) / (d5 * d5 + d6 * d6);
      double d12 = d9 + d11 * d5;
      double d13 = d10 + d11 * d6;
      if (i2 == 0)
      {
        if (d12 * d12 + d13 * d13 < 0.25D)
        {
          a((d_)this.k.h(localv.b()));
          d3 = d7;
          d4 = d8;
          if (i2 != 0) {
            break label274;
          }
          if (i1 == 0) {}
        }
        else
        {
          d1 = d3;
          d2 = d4;
          d3 = d7;
        }
      }
      else {
        d4 = d8;
      }
      localv = localv.a();
      if (i1 == 0) {
        break;
      }
    }
  }
  
  private d_ a(double paramDouble1, double paramDouble2)
  {
    if ((g.Cc != 0) || (this.l.size() > 0))
    {
      d_ locald_ = (d_)this.l.b();
      locald_.a();
      locald_.b = paramDouble1;
      locald_.c = paramDouble2;
      return locald_;
    }
    return new d_(paramDouble1, paramDouble2);
  }
  
  private void a(d_ paramd_)
  {
    this.l.c(paramd_);
  }
  
  private void f()
  {
    this.l.a(this.k);
  }
  
  private void b(double paramDouble)
  {
    int i2 = g.Cc;
    int i1 = g.Bc;
    double d1 = 1.0D;
    double d2 = 0.0D;
    v localv1 = this.k.g();
    v localv2 = this.k.f().a();
    if (localv2 != localv1) {}
    while (i2 != 0)
    {
      d_ locald_ = (d_)localv2.c();
      locald_.a();
      locald_.a = paramDouble;
      localv2 = localv2.a();
      if ((i2 == 0) && (i1 != 0)) {
        return;
      }
      if (i1 == 0) {
        break;
      }
    }
    this.i = (2.4D + (this.k.size() - 2) * (paramDouble * paramDouble));
  }
  
  private void c(double paramDouble)
  {
    int i2 = g.Cc;
    int i1 = g.Bc;
    do
    {
      for (v localv = this.k.f().a(); i1 == 0; localv = localv.a())
      {
        if (localv == null) {
          break;
        }
        a((d_)localv.b().c(), (d_)localv.c(), paramDouble);
      }
    } while (i2 != 0);
  }
  
  private void a(d_ paramd_1, d_ paramd_2, double paramDouble)
  {
    int i4 = g.Cc;
    int i3 = g.Bc;
    double d1 = paramd_2.b - paramd_1.b;
    double d2 = paramd_2.c - paramd_1.c;
    double d3 = Math.sqrt(d1 * d1 + d2 * d2);
    if ((i4 != 0) || (d3 > paramDouble))
    {
      int i1 = Math.min(10, (int)Math.ceil(d3 / paramDouble) - 1);
      double d4 = d1 / (i1 + 1);
      double d5 = d2 / (i1 + 1);
      double d6 = paramd_1.b + d4;
      double d7 = paramd_1.c + d5;
      int i2 = 0;
      do
      {
        if (i2 >= i1) {
          break;
        }
        d_ locald_ = a(d6, d7);
        locald_.i = this.k.a(locald_, paramd_2.i);
        d6 += d4;
        d7 += d5;
        i2++;
      } while (i3 == 0);
    }
  }
  
  private void c(d_ paramd_)
  {
    int i9 = g.Cc;
    int i8 = g.Bc;
    this.s += 1;
    d_ locald_ = (d_)paramd_.i.b().c();
    double d2;
    double d1 = d2 = 0.0D;
    double d3 = paramd_.b - locald_.b;
    double d4 = paramd_.c - locald_.c;
    double d5 = Math.sqrt(d3 * d3 + d4 * d4);
    if (i9 == 0)
    {
      if (d5 > 1.0E-006D)
      {
        double d8 = 1.0D / d5;
        double d6 = d3 * d8;
        double d7 = d4 * d8;
        int i1 = (int)Math.floor((Math.min(paramd_.b, locald_.b) - this.h.x - this.x) / this.o);
        int i2 = (int)Math.floor((Math.min(paramd_.c, locald_.c) - this.h.y - this.x) / this.p);
        int i3 = (int)Math.floor((Math.max(paramd_.b, locald_.b) - this.h.x + this.x) / this.o) + 1;
        int i4 = (int)Math.floor((Math.max(paramd_.c, locald_.c) - this.h.y + this.x) / this.p) + 1;
        i1 = Math.max(0, i1);
        i2 = Math.max(0, i2);
        i3 = Math.min(i3, this.j[0].length);
        i4 = Math.min(i4, this.j.length);
        int i5 = i2;
        label700:
        label709:
        label997:
        label1002:
        label1141:
        do
        {
          do
          {
            if (i5 >= i4) {
              break;
            }
            ArrayList[] arrayOfArrayList = this.j[i5];
            if ((i9 == 0) && (i8 != 0)) {
              break label1169;
            }
            int i6 = i1;
            do
            {
              if (i6 >= i3) {
                break label1141;
              }
              ArrayList localArrayList = arrayOfArrayList[i6];
              if (i8 != 0) {
                break;
              }
              int i7 = localArrayList.size() - 1;
              do
              {
                do
                {
                  if (i7 < 0) {
                    break label1128;
                  }
                  g_ localg_ = (g_)localArrayList.get(i7);
                  if (i8 != 0) {
                    break;
                  }
                  if (localg_.e != this.s)
                  {
                    localg_.e = this.s;
                    if (i9 != 0) {
                      continue;
                    }
                    if ((localg_.k != this.y) && ((i9 != 0) || (localg_.k != this.z)))
                    {
                      double d9 = localg_.a - locald_.b;
                      double d10 = localg_.b - locald_.c;
                      double d11 = Math.sqrt(d9 * d9 + d10 * d10);
                      double d13 = localg_.a - paramd_.b;
                      double d14 = localg_.b - paramd_.c;
                      double d12 = Math.sqrt(d13 * d13 + d14 * d14);
                      if ((i9 != 0) || ((d5 >= this.x) || ((i9 != 0) || ((d11 <= this.x + localg_.g) || ((i9 != 0) || (d12 <= this.x + localg_.g))))))
                      {
                        double d15 = (d9 * d3 + d10 * d4) / d5;
                        double d21 = -d15 / d5;
                        double d19 = d9 + d21 * d3;
                        double d20 = d10 + d21 * d4;
                        double d16 = Math.sqrt(d19 * d19 + d20 * d20);
                        if (i9 == 0) {
                          if (d16 == 0.0D)
                          {
                            d17 = d7;
                            d18 = -d6;
                            d16 = 1.E-005D;
                            if (i9 != 0) {
                              break label709;
                            }
                            if (i8 == 0) {
                              break label700;
                            }
                          }
                        }
                        double d22 = -1.0D / d16;
                        double d17 = d19 * d22;
                        double d18 = d20 * d22;
                        if (i9 == 0) {
                          if (d16 > 0.0D)
                          {
                            if (i9 == 0) {
                              if (d15 < 0.0D)
                              {
                                if (i9 == 0)
                                {
                                  if (localg_.g < d11)
                                  {
                                    d21 = -d15 + d15 * localg_.g / d11;
                                    if (i9 != 0) {
                                      break label1002;
                                    }
                                    d16 *= (1.0D - localg_.g / d11);
                                    if (i8 == 0) {
                                      break label997;
                                    }
                                  }
                                  d21 = -d15 + d15 * 0.999999D;
                                  if (i9 != 0) {
                                    break label1002;
                                  }
                                  d16 *= 1.000000000028756E-006D;
                                }
                                if (i8 == 0) {
                                  break label997;
                                }
                              }
                            }
                            if (i9 == 0)
                            {
                              if (d15 > d5)
                              {
                                if (i9 == 0)
                                {
                                  if (localg_.g < d12)
                                  {
                                    d21 = -d15 + (d15 - d5) * localg_.g / d12;
                                    if (i9 != 0) {
                                      break label1002;
                                    }
                                    d16 *= (1.0D - localg_.g / d12);
                                    if (i8 == 0) {
                                      break label997;
                                    }
                                  }
                                  d21 = -d15 + (d15 - d5) * 0.999999D;
                                  if (i9 != 0) {
                                    break label1002;
                                  }
                                  d16 *= 1.000000000028756E-006D;
                                }
                                if (i8 == 0) {
                                  break label997;
                                }
                              }
                              d21 = -d15;
                            }
                            if (i9 == 0)
                            {
                              if (localg_.g < d16)
                              {
                                if (i9 != 0) {
                                  break label1002;
                                }
                                d16 -= localg_.g;
                                if (i8 == 0) {
                                  break label997;
                                }
                              }
                              if (i9 != 0) {
                                break label1002;
                              }
                              d16 *= 1.000000000028756E-006D;
                            }
                            if (i8 == 0) {
                              break label997;
                            }
                          }
                        }
                        d16 = 1.0E-007D * (d16 + localg_.g);
                        d21 = -d15;
                        d22 = d21 + d5;
                        double d23 = d16 * d16;
                        double d24 = d21 * d21;
                        double d25 = d22 * d22;
                        double d28 = Math.sqrt(d24 + d23);
                        double d29 = Math.sqrt(d25 + d23);
                        double d26 = localg_.j * (1.0D / d28 - 1.0D / d29);
                        double d27 = localg_.j * (d16 * (d22 / (d23 * d29) - d21 / (d23 * d28)));
                        d1 += d6 * d26 + d17 * d27;
                        d2 += d7 * d26 + d18 * d27;
                      }
                    }
                  }
                  i7--;
                } while (i8 == 0);
                i6++;
              } while (i9 != 0);
            } while (i8 == 0);
            i5++;
          } while (i9 != 0);
        } while (i8 == 0);
        label1128:
        if (i9 == 0) {
          locald_.l += d1;
        }
        label1169:
        locald_.m += d2;
      }
      paramd_.l = d1;
      paramd_.m = d2;
    }
  }
  
  private double a(d_ paramd_, c_ paramc_)
  {
    d_ locald_ = (d_)paramd_.i.b().c();
    double d3 = locald_.b - paramd_.b;
    double d4 = locald_.c - paramd_.c;
    double d1 = d3 * 3.0D;
    double d2 = d4 * 3.0D;
    locald_ = (d_)paramd_.i.a().c();
    d3 = locald_.b - paramd_.b;
    d4 = locald_.c - paramd_.c;
    d1 += d3 * 3.0D;
    d2 += d4 * 3.0D;
    d1 += paramd_.l;
    d2 += paramd_.m;
    d1 += this.t.a(-0.5D, 0.5D);
    d2 += this.t.a(-0.5D, 0.5D);
    paramc_.a = d1;
    paramc_.b = d2;
    return Math.sqrt(d1 * d1 + d2 * d2);
  }
  
  private void a(d_ paramd_, c_ paramc_, double paramDouble)
  {
    int i2 = g.Cc;
    int i1 = g.Bc;
    if (i2 == 0)
    {
      if (paramDouble > 1.E-005D)
      {
        paramd_.g = paramd_.f;
        paramd_.j = paramd_.d;
        paramd_.k = paramd_.e;
        paramd_.d = paramc_.a;
        paramd_.e = paramc_.b;
        paramd_.f = paramDouble;
      }
    }
    else
    {
      double d1 = paramd_.d * paramd_.j + paramd_.e * paramd_.k;
      double d2 = d1 / (paramd_.f * paramd_.g);
      this.i -= paramd_.a * paramd_.a;
      if (i2 == 0) {
        if (paramd_.h * d2 > 0.0D)
        {
          paramd_.a += d2 * 0.45D;
          if (i2 != 0) {
            break label187;
          }
          if (i1 == 0) {
            break label178;
          }
        }
      }
      paramd_.a += d2 * 0.15D;
      label178:
      label187:
      if (i2 == 0)
      {
        if (paramd_.a > this.v)
        {
          paramd_.a = this.v;
          if (i2 != 0) {
            break label256;
          }
          if (i1 == 0) {}
        }
        else
        {
          if (i2 != 0) {
            break label257;
          }
        }
      }
      else if (paramd_.a < this.w) {
        paramd_.a = this.w;
      }
      this.i += paramd_.a * paramd_.a;
      label256:
      label257:
      paramd_.h = d2;
    }
  }
  
  private void e(d_ paramd_)
  {
    int i1 = g.Cc;
    if ((i1 != 0) || (paramd_.f > 0.0D))
    {
      double d = paramd_.a / paramd_.f;
      if (i1 == 0)
      {
        if (d > 0.0D) {
          paramd_.b += d * paramd_.d;
        }
      }
      else {
        paramd_.c += d * paramd_.e;
      }
    }
  }
  
  public rc a()
  {
    return this.f;
  }
  
  public void a(rc paramrc)
  {
    this.f = paramrc;
  }
  
  public double g()
  {
    return this.C;
  }
  
  public void d(double paramDouble)
  {
    this.C = paramDouble;
  }
  
  public boolean h()
  {
    return this.D;
  }
  
  public void b(boolean paramBoolean)
  {
    this.D = paramBoolean;
  }
  
  public boolean i()
  {
    return this.E;
  }
  
  public void c(boolean paramBoolean)
  {
    this.E = paramBoolean;
  }
  
  public vc j()
  {
    return new b_(null);
  }
  
  private final class b_
    implements vc
  {
    private rc e;
    
    private b_() {}
    
    public boolean canLayout(o paramo)
    {
      int i = g.Cc;
      if ((i != 0) || (this.e != null)) {
        if (i != 0) {
          break label33;
        }
      }
      label33:
      return this.e.canLayout(paramo);
    }
    
    public void doLayout(o paramo)
    {
      int k = g.Cc;
      int j = g.Bc;
      rc localrc = a();
      if (localrc != null)
      {
        double[] arrayOfDouble = new double[paramo.j() * 2];
        a.c.w localw = paramo.v();
        int i;
        zc localzc;
        double d1;
        double d2;
        do
        {
          if (!localw.e()) {
            break;
          }
          i = localw.d().f() << 1;
          localzc = paramo.d(localw.d());
          arrayOfDouble[(i++)] = localzc.c();
          arrayOfDouble[i] = localzc.d();
          d1 = Math.sqrt(localzc.c() * localzc.c() + localzc.d() * localzc.d()) + hb.this.C * 2.5D;
          d2 = localzc.a() + localzc.c() * 0.5D;
          double d3 = localzc.b() + localzc.d() * 0.5D;
          localzc.b(d1, d1);
          localzc.a(d2 - d1 * 0.5D, d3 - d1 * 0.5D);
          if (k != 0) {
            break label260;
          }
          localw.f();
          if (j != 0) {
            break label256;
          }
        } while (j == 0);
        if (k == 0) {
          localrc.doLayout(paramo);
        }
        label256:
        label260:
        localw = paramo.v();
        do
        {
          if (!localw.e()) {
            break;
          }
          i = localw.d().f() << 1;
          localzc = paramo.d(localw.d());
          d1 = localzc.a() + localzc.c() * 0.5D;
          d2 = localzc.b() + localzc.d() * 0.5D;
          localzc.b(arrayOfDouble[i], arrayOfDouble[(i + 1)]);
          localzc.a(d1 - arrayOfDouble[i] * 0.5D, d2 - arrayOfDouble[(i + 1)] * 0.5D);
          localw.f();
        } while (j == 0);
      }
    }
    
    public rc a()
    {
      return this.e;
    }
    
    public void a(rc paramrc)
    {
      this.e = paramrc;
    }
    
    b_(hb.0 param0)
    {
      this();
    }
  }
  
  static class c_
  {
    public double a;
    public double b;
  }
  
  static class d_
  {
    public double a;
    public double b;
    public double c;
    public double d;
    public double e;
    public double f;
    public double g;
    public double h;
    public v i;
    public double j;
    public double k;
    public double l;
    public double m;
    public double n;
    
    public d_(double paramDouble1, double paramDouble2)
    {
      a();
      this.b = paramDouble1;
      this.c = paramDouble2;
    }
    
    public void a()
    {
      this.g = 1.0E-006D;
      this.h = 0.1D;
      this.f = 1.0E-006D;
      this.n = (this.m = this.l = 0.0D);
      this.d = (this.e = 0.0D);
      this.e = 1.0E-006D;
      this.a = 0.0D;
      this.j = 0.0D;
      this.k = 1.0E-006D;
    }
  }
  
  static class g_
  {
    public double a;
    public double b;
    public double c;
    public double d;
    public int e;
    public double g;
    public double h;
    public double j;
    public int k;
    
    public g_(int paramInt, double paramDouble1, double paramDouble2, double paramDouble3, double paramDouble4)
    {
      this.a = paramDouble1;
      this.b = paramDouble2;
      this.k = paramInt;
      this.g = paramDouble3;
      this.h = paramDouble3;
      this.j = paramDouble4;
      this.e = -1;
    }
  }
  
  static class e_
    implements Comparator
  {
    public int compare(Object paramObject1, Object paramObject2)
    {
      int i = g.Cc;
      hb.g_ localg_1 = (hb.g_)paramObject1;
      hb.g_ localg_2 = (hb.g_)paramObject2;
      if (i == 0) {
        if (localg_1.g < localg_2.g) {
          return 1;
        }
      }
      if (i == 0) {
        if (localg_1.g > localg_2.g) {
          return -1;
        }
      }
      return 0;
    }
  }
  
  static class f_
    implements Comparator
  {
    private o a;
    
    f_(o paramo)
    {
      this.a = paramo;
    }
    
    public int compare(Object paramObject1, Object paramObject2)
    {
      int i = g.Cc;
      e locale1 = (e)paramObject1;
      e locale2 = (e)paramObject2;
      a.d.w localw1 = this.a.o(locale1);
      a.d.w localw2 = this.a.o(locale2);
      if (i == 0) {
        if (localw1.a() < localw2.a()) {
          return -1;
        }
      }
      if (i == 0) {
        if (localw1.a() > localw2.a()) {
          return 1;
        }
      }
      if (i == 0) {
        if (localw1.b() < localw2.b()) {
          return -1;
        }
      }
      if (i == 0) {
        if (localw1.b() > localw2.b()) {
          return 1;
        }
      }
      return 0;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.l.hb

 * JD-Core Version:    0.7.0.1

 */